home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / mus / play / tracker_4_31.lzh / tracker / tools.c < prev   
C/C++ Source or Header  |  1995-02-21  |  831b  |  44 lines

  1. /* tools.c 
  2.     vi:ts=3 sw=3:
  3.  */
  4.  
  5. /* standard routines for use in tracker. Used to be in main.c
  6.  */
  7.  
  8. /* $Id: tools.c,v 4.12 1995/02/21 21:13:16 espie Exp espie $
  9.  * $Log: tools.c,v $
  10.  * Revision 4.12  1995/02/21  21:13:16  espie
  11.  * Cleaned up source. Moved minor pieces of code around.
  12.  *
  13.  * Revision 4.11  1995/02/21  17:54:32  espie
  14.  * Internal problem: buggy RCS. Fixed logs.
  15.  *
  16.  */
  17.      
  18.  
  19. #include "defs.h"
  20. #include "extern.h"
  21.      
  22. ID("$Id: tools.c,v 4.12 1995/02/21 21:13:16 espie Exp espie $")
  23.  
  24.  
  25. /* v = read_env(name, default): read the scalar value v in the environment, 
  26.  * supply default value.
  27.  */
  28. int read_env(name, def)
  29. char *name;
  30. int def;
  31.    {
  32.    char *var;
  33.    int value;
  34.  
  35.    var = getenv(name);
  36.    if (!var)
  37.       return def;
  38.    if (sscanf(var, "%d", &value) == 1)
  39.       return value;
  40.    else
  41.       return def;
  42.    }
  43.  
  44.